package com.doyens.service.Impl;

import com.doyens.mapper.StudentMapper;
import com.doyens.pojo.Student;
import com.doyens.service.StudentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;
    /**
     * 查询学生表
     */
    @Override
    public PageInfo<Student> findAllStu(Integer pageNum) {
        PageHelper.startPage(pageNum,8);
        return new PageInfo<Student>(studentMapper.findAllStu());
    }

    @Override
    public Student findById(Integer id) {
        return studentMapper.findById(id);
    }

    @Override
    public int delete(Integer id) {
        return studentMapper.delete(id);
    }

    @Override
    public int save(Student student) {
        return studentMapper.save(student);
    }

    @Override
    public Integer update(Student student) {
        return studentMapper.update(student);
    }
}
